package com.muyu.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.text.SimpleDateFormat;

/**
 * @ClassName: JacksonConfig
 * @Author: Zirun.Xin
 * @Date: 2025/4/28 下午4:31
 * @Version: 1.0
 * @Description: jackson序列化配置
 */
@Configuration
public class JacksonConfig {

    /**
     * 初始化ObjectMapper实例
     * @return ObjectMapper实例
     */
    @Bean
    public ObjectMapper objectMapper() {
        ObjectMapper objectMapper = new ObjectMapper();

        // 自定义日期转换格式
        objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));

        return objectMapper;
    }
}
